<!--会员中心 》个人信息-->
<template>
  <div style="width: 100%;height: 600px;margin-left: 60px;overflow: hidden;
        padding: 20px 20px;box-sizing: border-box;font-size: 17px">

    <!--  修改头像部分开始  -->
    <el-row :gutter="20">
      <el-col :span="12">
        <div style="float: left;margin-right: 20px">
          <el-avatar shape="square"
                     :size="60"
                     :src="'http://localhost:29000'+user.imgUrl"></el-avatar>
        </div>
        <div style="float: left;text-align: left">
          <span style="margin-right: 20px">{{ user.username }}</span>
          <el-button @click="locationPersoninfoAlter" style="width: 100px;height: 10px" type="primary" plain>
            <p class="el-icon-edit" style="position: relative;top: -6px ;left: -6px;font-size: 15px;font-weight: bold">
              修改资料</p>
          </el-button>
          <br>
          <span style="font-size: 14px">会员编号：{{integrals.memberNum }}</span>
        </div>
      </el-col>
      <el-col :span="12">

      </el-col>
    </el-row>
    <!--  修改头像部分结束  -->

    <!--    我的积分开始-->
    <div class="earnPoints_row" style="height: 50px;background-color: #E5F4ff;border-radius: 5px">
      <el-row :gutter="20">
        <el-col :span="4"><p class="el-icon-coin" style="font-size: 16px">我的积分</p></el-col>
        <el-col :span="4">
          <p>
            <el-tooltip :content="'正式积分'+integrals.balance+'分'" placement="bottom" effect="light">
              <el-link :underline="false">{{ integrals.balance }}正式积分</el-link>
            </el-tooltip>
          </p>
        </el-col>
        <el-col :span="12">
          <p>
            <el-tooltip content="临时积分0分" placement="bottom" effect="light">
              <el-link :underline="false">0临时积分（当正式积分>0时可使用，临时积分每日0点清空）</el-link>
            </el-tooltip>
          </p>
        </el-col>
        <el-col :span="4">
          <p>
            <el-button type="primary" @click="locationEarnPoints" round>去充值</el-button>
          </p>
        </el-col>
      </el-row>
    </div>
    <!--    我的积分结束-->

    <!--    我的认证开始-->
    <div style="padding:50px 0px;box-sizing: border-box ">
      <div style="margin-bottom: 30px">您还未完成实名认证,完成实名认证、企业认证并开通企业管理。</div>
      <div>
        <el-button type="primary" @click="locationAuthentica">去认证</el-button>
      </div>
    </div>
    <!--    我的认证结束-->


  </div>
</template>

<script>
export default {
  name: "PersonInfo",
  data() {
    return {
      user:{},
      integrals:{memberNum:'',balance:''}
    }
  },
  methods: {



    locationPersoninfoAlter(){
      this.$router.push("/member/alterpersoninfo")
    },

    locationEarnPoints(){
      this.$router.push("/member/earnpoints")
    },

    locationAuthentica(){
      this.$router.push("/member/authentica")
    }

  },
  mounted() {
    this.user = JSON.parse(localStorage.getItem('user'));
    if (this.user == null) {
      this.$message.error("请登录后重试！");
      this.$router.push('/login');
    }

    let jwt=JSON.parse(localStorage.getItem('user')).token;
    this.axios
        .create({
          'headers': {
            'Authorization': jwt
          }
        })
        .get('http://localhost:29000/v1/integrals/get')
      .then((response)=>{
      if (response.data.code==20000){
        this.integrals=response.data.data;
      }
    })




  }
}
</script>

<style scoped>
.el-row {
  margin-bottom: 20px;
}

.earnPoints_row {
  line-height: 50px;
  margin-bottom: 20px;
}

</style>